package com.traffic.service.impl;

import com.ruoyi.common.security.utils.BaseUtil;
import com.traffic.domain.FamilyBasicInformation;
import com.traffic.mapper.FamilyBasicInformationMapper;
import com.traffic.service.IFamilyBasicInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户家属基础信息Service业务层处理
 * 
 * @author zzs
 * @date 2024-11-07
 */
@Service
public class FamilyBasicInformationServiceImpl implements IFamilyBasicInformationService 
{
    @Autowired
    private FamilyBasicInformationMapper familyBasicInformationMapper;

    /**
     * 查询用户家属基础信息
     * 
     * @param id 用户家属基础信息主键
     * @return 用户家属基础信息
     */
    @Override
    public FamilyBasicInformation selectFamilyBasicInformationById(Long id)
    {
        return familyBasicInformationMapper.selectFamilyBasicInformationById(id);
    }

    /**
     * 查询用户家属基础信息列表
     * 
     * @param familyBasicInformation 用户家属基础信息
     * @return 用户家属基础信息
     */
    @Override
    public List<FamilyBasicInformation> selectFamilyBasicInformationList(FamilyBasicInformation familyBasicInformation)
    {
        Long currentId = BaseUtil.getCurrentId();
        familyBasicInformation.setUserId(currentId);
        return familyBasicInformationMapper.selectFamilyBasicInformationList(familyBasicInformation);
    }

    /**
     * 新增用户家属基础信息
     * 
     * @param familyBasicInformation 用户家属基础信息
     * @return 结果
     */
    @Override
    public int insertFamilyBasicInformation(FamilyBasicInformation familyBasicInformation)
    {
        Long currentId = BaseUtil.getCurrentId();
        familyBasicInformation.setUserId(currentId);
        return familyBasicInformationMapper.insertFamilyBasicInformation(familyBasicInformation);
    }

    /**
     * 修改用户家属基础信息
     * 
     * @param familyBasicInformation 用户家属基础信息
     * @return 结果
     */
    @Override
    public int updateFamilyBasicInformation(FamilyBasicInformation familyBasicInformation)
    {
        return familyBasicInformationMapper.updateFamilyBasicInformation(familyBasicInformation);
    }

    /**
     * 批量删除用户家属基础信息
     * 
     * @param ids 需要删除的用户家属基础信息主键
     * @return 结果
     */
    @Override
    public int deleteFamilyBasicInformationByIds(Long[] ids)
    {
        return familyBasicInformationMapper.deleteFamilyBasicInformationByIds(ids);
    }

    /**
     * 删除用户家属基础信息信息
     * 
     * @param id 用户家属基础信息主键
     * @return 结果
     */
    @Override
    public int deleteFamilyBasicInformationById(Long id)
    {
        return familyBasicInformationMapper.deleteFamilyBasicInformationById(id);
    }
}
